define('app/demo/audit/auditList', function (require, exports, module) {
    'use strict';
    var $=require('jquery'),
	    Widget = require('arale-widget/1.2.0/widget'),
	    Dialog = require("optDialog/src/dialog"),
//	    Paging = require('paging/0.0.1/paging-debug'),
	    AjaxController = require('opt-ajax/1.0.0/index');
    require("jsviews/jsrender.min");
    require("jsviews/jsviews.min");
    require("my97DatePicker/WdatePicker");
    require("bootstrap-paginator/bootstrap-paginator.min");
    require("app/util/jsviews-ext");
    require("opt-paging/aiopt.pagination");

    var SendMessageUtil = require("app/util/sendMessage");
    
    //实例化AJAX控制处理对象
    var ajaxController = new AjaxController();
//    var clickId = "";
    //定义页面组件类
    var addlistPager = Widget.extend({
    	
    	Implements:SendMessageUtil,
    	//属性，使用时由类的构造函数传入
    	attrs: {
    		clickId:""
    	},
    	Statics: {
    		DEFAULT_PAGE_SIZE: 10
    	},
    	//事件代理
    	events: {
    		"click #refuseReasonCloseImg":"_closeEditDiv",
    		"click #refuseReasonBtn":"_closeEditDiv",
    		//查询
            "click #selectList":"_selectProductList"
            },
    	//重写父类
    	setup: function () {
			addlistPager.superclass.setup.call(this);
    		this._selectProductList();
    	},
    	
    	//查询商品列表
    	_selectProductList:function(){
    		var _this = this;
    		$("#pagination-ul").runnerPagination({
	 			url: _base+"/auditdemo/getAuditList",
	 			method: "POST",
	 			dataType: "json",
	 			renderId:"searchAuditData",
	 			messageId:"showMessageDiv",
	 			pageSize: addlistPager.DEFAULT_PAGE_SIZE,
	 			visiblePages:5,
	 			data: {"a": "1"},
	 			render: function (data) {
	            	if(data != null && data !== 'undefined' && data.length>0){
	            		var template = $.templates("#searchNormProductTemple");
	            	    var htmlOutput = template.render(data);
	            	    $("#searchAuditData").html(htmlOutput);
	            	}
	            	_this._returnTop();
	            }
    		});
    	},
    	
    	//弹出原因框
    	_showReason:function(prodId){
//    		var _this = this;
			//后台获取数据,
			ajaxController.ajax({
				type: "get",
				processing: true,
				message: "数据获取中,请等待...",
				url: _base+"/prodquery/toViewReason/"+prodId,
				success: function(data){
					//获取数据成功
					if("1"===data.statusCode){
						var reason= data.data.refuseDes;
						var reasonHtml="<textarea id=\"refuseDes\" name=\"refuseDes\" " +
								"style=\"width:270px;height:160px;overflow:hidden; resize:none;\" readOnly=\"true\">";
						reasonHtml += reason+"</textarea>";
						new Dialog({
							content:reasonHtml,
							okValue: '确 定',
							title:'商品拒绝原因',
							ok:function(){
								this.close();
							}
						}).show();
						
						//this._showSuccessMsg(jkjkj);
						/*var reason= data.data;
						$("#refuseDes").val(reason.refuseDes);

						$('#eject-mask').fadeIn(100);
						$('#refuseReason-samll').slideDown(200);*/
					}
				}
			});

		},
		
		//关闭编辑页面弹出
		_closeEditDiv:function(){
			$('#eject-mask').fadeOut(100);
			$('#refuseReason-samll').slideUp(150);
			//清空数据
			$("#refuseDes").val("");
		},
		 //显示信息
        _showSuccessMsg:function(msg){
            var d = Dialog({
                content:msg,
                okValue: '确 定',
                title: '提示',
                ok:function(){
                    this.close();
                }
            });
            d.show();
        },
    	//滚动到顶部
    	_returnTop:function(){
    		var container = $('.wrapper-right');
    		container.scrollTop(0);//滚动到div 顶部
    	},
    	
    });
    
    module.exports = addlistPager;
});
